from flask import Flask, url_for, request, redirect, render_template,Response,jsonify
from flask_sqlalchemy import SQLAlchemy
import json
from AdminApiRunner.app.json_encoder import AlchemyEncoder
from flask_nameko import FlaskPooledClusterRpcProxy
from flasgger import Swagger
#
# app = Flask(__name__)
# app.config.from_object('config')
# db = SQLAlchemy(app)

def create_app():
    app = Flask(__name__)
    app.config.from_object('config')
    db = SQLAlchemy(app)

    app.json_encoder = AlchemyEncoder
    rpc = FlaskPooledClusterRpcProxy()
    rpc.init_app(app)
    Swagger(app)
    return app,db,rpc

app, db, rpc = create_app()

from AdminApiRunner.app import models,views
from AdminApiRunner.core import views
